//
//  ViewController.swift
//  中介者模式
//
//  Created by 崔博 on 2017/8/30.
//  Copyright © 2017年 崔博. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
    }
}

struct Position {
    var distanceFromRunWay:Int
    var height:Int
    
    func euq(ihs: Airplane, rhs: Airplane) -> Bool {
        return ihs.name == rhs.name;
    }
}

class Airplane: Equatable {
    var name:String?
    var currentPosition: Position
    private var otherPlanes:[Airplane]
    init(name:String, initialPods:Position) {
        self.name = name;
        self.currentPosition = initialPods
        self.otherPlanes = [Airplane]()
    }
    func addPlanesInArea(planes:Airplane...) {
        for plane in planes {
            otherPlanes.append(plane)
        }
    }
    
    func otherPlaneDidLand(plane: Airplane) {
        if let index = find(otherPlanes,plane) {
            otherPlanes.remove(at: index)
        }
    }
}
